SUMMARY = "Realtek rtl8723du Driver"
DESCRIPTION = "Realtek rtl8723du Driver"
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""

SRC_URI = "file://rtl8723DU_WiFi_linux_v5.13.4-18-gda9ee5bf0.20210615_COEX20200103-3535.tar.gz"

S = "${WORKDIR}/rtl8723DU_WiFi_linux_v5.13.4-18-gda9ee5bf0.20210615_COEX20200103-3535"
DEPENDS = "virtual/kernel"

inherit module

EXTRA_OEMAKE  = "ARCH=${ARCH}"
EXTRA_OEMAKE += "KSRC=${STAGING_KERNEL_BUILDDIR}"
EXTRA_OEMAKE += "USER_EXTRA_CFLAGS='-DCONFIG_LITTLE_ENDIAN -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT -Wno-unused-parameter -Wno-error=sign-compare -Wno-error=maybe-uninitialized -Wno-error=date-time'"

do_setplatflag() {
	bbplain "rtl8723du-mod.bb setplatflag will modify Makefile."
	sed -i 's/CONFIG_PLATFORM_I386_PC = y/CONFIG_PLATFORM_I386_PC = n/g' ${S}/Makefile
	sed -i 's/CONFIG_RTW_LOG_LEVEL = 4/CONFIG_RTW_LOG_LEVEL = 0/g' ${S}/Makefile
}

addtask do_setplatflag before do_compile after do_patch

do_install () {
    install -d ${D}/lib/modules/${KERNEL_VERSION}/extra
    install -m 0755 ${B}/8723du.ko ${D}/lib/modules/${KERNEL_VERSION}/extra/8723du.ko
}

RPROVIDES_${PN} += "kernel-module-rtl8723du"

FILES_${PN} = " \
         \
"